Optimal. Leaf size=227 \[ -\frac {x}{a^2}-\frac {2 b^5 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{5/2} (a+b)^{5/2} d}-\frac {4 b^3 \left (2 a^2-b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{5/2} (a+b)^{5/2} d}-\frac {\sin (c+d x)}{2 (a+b)^2 d (1-\cos (c+d x))}+\frac {\sin (c+d x)}{2 (a-b)^2 d (1+\cos (c+d x))}+\frac {b^4 \sin (c+d x)}{a \left (a^2-b^2\right )^2 d (b+a \cos (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.31, antiderivative size = 227, normalized size of antiderivative = 1.00, number of steps
used = 11, number of rules used = 7, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3983, 2976,
2727, 2743, 12, 2738, 214} \begin {gather*} -\frac {2 b^5 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d (a-b)^{5/2} (a+b)^{5/2}}+\frac {b^4 \sin (c+d x)}{a d \left (a^2-b^2\right )^2 (a \cos (c+d x)+b)}-\frac {4 b^3 \left (2 a^2-b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d (a-b)^{5/2} (a+b)^{5/2}}-\frac {x}{a^2}-\frac {\sin (c+d x)}{2 d (a+b)^2 (1-\cos (c+d x))}+\frac {\sin (c+d x)}{2 d (a-b)^2 (\cos (c+d x)+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 214
Rule 2727
Rule 2738
Rule 2743
Rule 2976
Rule 3983
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x)}{(a+b \sec (c+d x))^2} \, dx &=\int \frac {\cos ^2(c+d x) \cot ^2(c+d x)}{(b+a \cos (c+d x))^2} \, dx\\ &=\int \left (-\frac {1}{a^2}-\frac {1}{2 (a-b)^2 (-1-\cos (c+d x))}+\frac {1}{2 (a+b)^2 (1-\cos (c+d x))}+\frac {b^4}{a^2 \left (a^2-b^2\right ) (-b-a \cos (c+d x))^2}+\frac {2 \left (2 a^2 b^3-b^5\right )}{a^2 \left (a^2-b^2\right )^2 (-b-a \cos (c+d x))}\right ) \, dx\\ &=-\frac {x}{a^2}-\frac {\int \frac {1}{-1-\cos (c+d x)} \, dx}{2 (a-b)^2}+\frac {\int \frac {1}{1-\cos (c+d x)} \, dx}{2 (a+b)^2}+\frac {b^4 \int \frac {1}{(-b-a \cos (c+d x))^2} \, dx}{a^2 \left (a^2-b^2\right )}+\frac {\left (2 b^3 \left (2 a^2-b^2\right )\right ) \int \frac {1}{-b-a \cos (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )^2}\\ &=-\frac {x}{a^2}-\frac {\sin (c+d x)}{2 (a+b)^2 d (1-\cos (c+d x))}+\frac {\sin (c+d x)}{2 (a-b)^2 d (1+\cos (c+d x))}+\frac {b^4 \sin (c+d x)}{a \left (a^2-b^2\right )^2 d (b+a \cos (c+d x))}+\frac {b^4 \int \frac {b}{-b-a \cos (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )^2}+\frac {\left (4 b^3 \left (2 a^2-b^2\right )\right ) \text {Subst}\left (\int \frac {1}{-a-b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 \left (a^2-b^2\right )^2 d}\\ &=-\frac {x}{a^2}-\frac {4 b^3 \left (2 a^2-b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{5/2} (a+b)^{5/2} d}-\frac {\sin (c+d x)}{2 (a+b)^2 d (1-\cos (c+d x))}+\frac {\sin (c+d x)}{2 (a-b)^2 d (1+\cos (c+d x))}+\frac {b^4 \sin (c+d x)}{a \left (a^2-b^2\right )^2 d (b+a \cos (c+d x))}+\frac {b^5 \int \frac {1}{-b-a \cos (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )^2}\\ &=-\frac {x}{a^2}-\frac {4 b^3 \left (2 a^2-b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{5/2} (a+b)^{5/2} d}-\frac {\sin (c+d x)}{2 (a+b)^2 d (1-\cos (c+d x))}+\frac {\sin (c+d x)}{2 (a-b)^2 d (1+\cos (c+d x))}+\frac {b^4 \sin (c+d x)}{a \left (a^2-b^2\right )^2 d (b+a \cos (c+d x))}+\frac {\left (2 b^5\right ) \text {Subst}\left (\int \frac {1}{-a-b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 \left (a^2-b^2\right )^2 d}\\ &=-\frac {x}{a^2}-\frac {2 b^5 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{5/2} (a+b)^{5/2} d}-\frac {4 b^3 \left (2 a^2-b^2\right ) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{5/2} (a+b)^{5/2} d}-\frac {\sin (c+d x)}{2 (a+b)^2 d (1-\cos (c+d x))}+\frac {\sin (c+d x)}{2 (a-b)^2 d (1+\cos (c+d x))}+\frac {b^4 \sin (c+d x)}{a \left (a^2-b^2\right )^2 d (b+a \cos (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.82, size = 209, normalized size = 0.92 \begin {gather*} \frac {(b+a \cos (c+d x)) \sec ^2(c+d x) \left (-\frac {2 (c+d x) (b+a \cos (c+d x))}{a^2}-\frac {4 b^3 \left (-4 a^2+b^2\right ) \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right ) (b+a \cos (c+d x))}{a^2 \left (a^2-b^2\right )^{5/2}}-\frac {(b+a \cos (c+d x)) \cot \left (\frac {1}{2} (c+d x)\right )}{(a+b)^2}+\frac {2 b^4 \sin (c+d x)}{a (a-b)^2 (a+b)^2}+\frac {(b+a \cos (c+d x)) \tan \left (\frac {1}{2} (c+d x)\right )}{(a-b)^2}\right )}{2 d (a+b \sec (c+d x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.22, size = 184, normalized size = 0.81
method | result | size |
derivativedivides | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}-4 b a +2 b^{2}}+\frac {2 b^{3} \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a -b}-\frac {\left (4 a^{2}-b^{2}\right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right )^{2} \left (a -b \right )^{2} a^{2}}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2}}}{d}\) | \(184\) |
default | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}-4 b a +2 b^{2}}+\frac {2 b^{3} \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-a -b}-\frac {\left (4 a^{2}-b^{2}\right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right )^{2} \left (a -b \right )^{2} a^{2}}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a^{2}}}{d}\) | \(184\) |
risch | \(-\frac {x}{a^{2}}-\frac {2 i \left (-2 a^{4} b \,{\mathrm e}^{3 i \left (d x +c \right )}-b^{5} {\mathrm e}^{3 i \left (d x +c \right )}+a^{5} {\mathrm e}^{2 i \left (d x +c \right )}-3 a^{3} b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-a \,b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+2 a^{2} b^{3} {\mathrm e}^{i \left (d x +c \right )}+b^{5} {\mathrm e}^{i \left (d x +c \right )}+a^{5}+a^{3} b^{2}+a \,b^{4}\right )}{\left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right ) \left (a^{2}-b^{2}\right )^{2} a^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) d}-\frac {4 b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}+\frac {b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,a^{2}}+\frac {4 b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}-\frac {b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,a^{2}}\) | \(529\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.59, size = 705, normalized size = 3.11 \begin {gather*} \left [\frac {4 \, a^{5} b^{2} - 2 \, a^{3} b^{4} - 2 \, a b^{6} - {\left (4 \, a^{2} b^{4} - b^{6} + {\left (4 \, a^{3} b^{3} - a b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) \sin \left (d x + c\right ) - 2 \, {\left (a^{7} - a b^{6}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} \cos \left (d x + c\right ) - 2 \, {\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d x \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d x\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{9} - 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} - a^{3} b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} d\right )} \sin \left (d x + c\right )}, \frac {2 \, a^{5} b^{2} - a^{3} b^{4} - a b^{6} - {\left (4 \, a^{2} b^{4} - b^{6} + {\left (4 \, a^{3} b^{3} - a b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - {\left (a^{7} - a b^{6}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} \cos \left (d x + c\right ) - {\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d x \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d x\right )} \sin \left (d x + c\right )}{{\left ({\left (a^{9} - 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} - a^{3} b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} d\right )} \sin \left (d x + c\right )}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cot ^{2}{\left (c + d x \right )}}{\left (a + b \sec {\left (c + d x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.53, size = 332, normalized size = 1.46 \begin {gather*} -\frac {\frac {4 \, {\left (4 \, a^{2} b^{3} - b^{5}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{6} - 2 \, a^{4} b^{2} + a^{2} b^{4}\right )} \sqrt {-a^{2} + b^{2}}} - \frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2} - 2 \, a b + b^{2}} + \frac {a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 3 \, a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 4 \, b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{4} + a^{3} b + a^{2} b^{2} - a b^{3}}{{\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}} + \frac {2 \, {\left (d x + c\right )}}{a^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.46, size = 2500, normalized size = 11.01 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________